import java.util.Scanner;

public class DayOfTheYearCalculator {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入年份：");
        int year = scanner.nextInt();
        System.out.print("请输入月份：");
        int month = scanner.nextInt();
        System.out.print("请输入日期：");
        int day = scanner.nextInt();
        if (month < 1 || month > 12 || day < 1 || day > 31) {
            System.out.println("无效的输入。请输入有效的年月日。");
            return;
        }
        int[] daysInMonth = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};  // 存储每个月的天数
        if (month == 2 && (year % 4 == 0 && year % 100!= 0 || year % 400 == 0)) {
            daysInMonth[2] = 29;  // 如果是闰年，二月份有 29 天
        }
        int totalDays = day;
        for (int i = 0; i < month - 1; i++) {
            totalDays += daysInMonth[i];  // 累计前几个月的天数
        }
        System.out.println("这一天是这一年的第 " + totalDays + " 天。");
    }
}